var app = getApp();

Page({
    data: {
        clientList:"",
        modalContract:false,
        star:0,
        starMap: [
            '非常差',
            '差',
            '一般',
            '好',
            '非常好',
        ],
        index:0,
        shopname:'',
        uPrice:''
    },
    onLoad: function(n) {
        var self = this;
        self.loadUserList();
    },
    loadUserList:function(){
        var self = this;
        app.util.request({
            url: "entry/wxapp/Hz_userlist",
            data: {
                openid: wx.getStorageSync("openid")
            },
            success: function(a) {
                console.log("代理商"+JSON.stringify(a));
                self.setData({
                    clientList:a.data.data
                })
            }
        });
    },
      htPriceInput:function(e){
    this.setData({
      htPrice:e.detail.value
    })
  },
  whPriceInput:function(e){
    this.setData({
      whPrice:e.detail.value
    })
  },
  hdlApplyHt:function(){
    var self = this;
    app.util.request({
            url: "entry/wxapp/Hz_contract",
            data: {
                openid:wx.getStorageSync("openid"),
                goodsid:self.data.agentId,
                price:self.data.htPrice,
                wh_price:self.data.whPrice,
                mobile:self.data.umobile,
                hzuserid:self.data.uid,
            },
            success: function(o) {
                 wx.showToast({
                        title: "添加成功!"
                    });
               setTimeout(function(){
                     self.setData({
                       modalContract:false
                    })
                }, 1000);
            }
        });
  },

    lockSuperior:function(e){
        var self = this,ccusId = e.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/hyb_jianzhi/edit_superior/edit_superior?typeId=" +ccusId
        });
    },
    hideClickSwiter:function(){
        var self = this;
        self.setData({
            modalContract:false

        })
    },
    getform: function(o) {
        console.log(o), app.util.request({
            url: "entry/wxapp/Formid",
            data: {
                openid: wx.getStorageSync("openid"),
                formid: o
            },
            success: function(o) {}
        });
    },
    addContract:function(n){
        var self = this,uid=n.currentTarget.dataset.id,umobile=n.currentTarget.dataset.umobile;
         self.setData({
            modalContract:true,
            uid:uid,
            umobile:umobile
        })
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});